package com.pig4cloud.pigx.system.constant;

import lombok.Getter;

/**
 * @Description: 邮件模板类型参数
 * @Date: 2022/9/27 10:48
 */
public enum EmailTemplateTypeEnum {

    /**
     * 合约强制平仓通知
     */
    FORCED_LIQUIDATION_OF_CONTRACTS("合约强制平仓通知", null, "1563415493535264768,1563415882619875328"),
    /**
     * 合约追加保证金
     */
    CONTRACT_MARGIN_CALL("合约追加保证金", null, "1563415493535264768,1563415994377105408"),
    /**
     * 确认提现
     */
    CONFIRM_WITHDRAWAL("确认提现", "WithdrawalRequest", "1563415493535264768,1563416379904946176"),
    /**
     * 提现成功
     */
    WITHDRAWAL_SUCCESS("提现成功", "WithdrawalSuccess", "1563415493535264768,1563422664922689536"),
    /**
     * 充值成功
     */
    RECHARGED_SUCCESSFULLY("充值成功", "RechargeRecordSuccess", "1563415493535264768,1563840055018180608"),
    /**
     * 用户注册
     */
    USER_REGISTRATION("用户注册", "CustomerRegistration", "1563415493535264768,1563425956063014912"),
    /**
     * 用户邮箱登录
     */
    EMAIL_LOGIN("用户邮箱登录", "EmailLogin", "1563415493535264768,1597871435382726658"),
    /**
     * 用户修改邮箱
     */
    USER_CHANGES_EMAIL("用户修改邮箱", "CustomerModifyEmail", "1563415493535264768,1563426261370597376"),
	/**
	 * 用户修改地址
	 */
	USER_CHANGES_ADDRESS("用户修改地址", "CustomerModifyAddress", "1563415493535264768,1622465814797692929"),
    /**
     * 用户修改支付密码
     */
    USER_CHANGES_PAYMENT_PASSWORD("用户修改支付密码 ", "CustomerModifyMoneyPassword", "1563415493535264768,1563426774375919616"),
    /**
     * 成为经纪人
     */
    BECOME_BROKER("成为经纪人", "BecomeBroker", "1563415493535264768,1574649347681890305"),
    /**
     * 经纪人返佣到账
     */
    BROKER_RECEIVED_THE_COMMISSION("经纪人返佣到账", null, "1563415493535264768,1574649475801100290"),
    /**
     * 资金账户后台-充值/奖励/平台手工
     */
    FUND_ACCOUNT_BACKGROUND_RECHARGE("资金账户后台-资金充值", null, "1563415493535264768,1579457127578869761"),
    /**
     * 资金账户后台-冻结/解冻
     */
    FUND_ACCOUNT_BACKGROUND_FROZEN("资金账户后台-冻结/解冻", null, "1563415493535264768,1579457280129900545"),
    /**
     * 意见反馈已通过
     */
    FEEDBACK_WAS_ACCEPTED("意见反馈已通过", null, "1563415493535264768,1580866101288968193"),
    /**
     * 用户创建ApiKey
     */
    USER_API_KEY_CREATE("用户创建ApiKey ", "CustomerApiKeyCreate", "1563415493535264768,1587322868700221442"),
    /**
     * 用户开启ApiKey提现权限
     */
    USER_API_KEY_ENABLE_WITHDRAWAL("用户开启ApiKey提现权限 ", "CustomerApiKeyEnableWithdrawal", "1563415493535264768,1587323133868314626"),
    /**
     * 客户查询SecretKey
     */
    CUSTOMER_SECRET_KEY_SELECT("用户开启ApiKey提现权限 ", "CustomerSecretKeySelect", "1563415493535264768,1592427508411879425"),
    /**
     * 策略开启通知
     */
    OPEN_STRATEGY("策略开启通知 ", "openStrategy", "1563415493535264768,1601834541477691394"),
    /**
     * 策略关闭通知
     */
    CLOSE_STRATEGY("策略关闭通知 ", "CloseStrategy", "1563415493535264768,1601834604807487490"),
    /**
     * 策略暂停通知
     */
    SUSPEND_STRATEGY("策略暂停通知 ", "SuspendStrategy", "1563415493535264768,1601834713549012994"),
    /**
     * 策略恢复通知
     */
    RECOVERY_STRATEGY("策略恢复通知 ", "RecoveryStrategy", "1563415493535264768,1601834783736496129"),
    /**
     * 策略异常通知
     */
    ERROR_STRATEGY("策略异常通知 ", "ErrorStrategy", "1563415493535264768,1601834950300696578"),
    /**
     * 策略异常解决通知
     */
    ERROR_RESOLVE_STRATEGY("策略异常解决通知 ", "ErrorResolveStrategy", "1563415493535264768,1601874505433198593"),
    /**
     * 用户燃油币账户余额不足通知
     */
    USER_FUEL_WARNING("用户燃油币账户余额不足通知 ", "UserFuelWarning", "1563415493535264768,1601837598380773378");

    /**
     * 文章类型名称
     */
    @Getter
    private String name;

    /**
     * 文章类型编号（代码用）
     */
    @Getter
    private String code;

    /**
     * 数据库文章类型编号
     */
    @Getter
    private String articleTypeCode;

    EmailTemplateTypeEnum(String name, String code, String articleTypeCode) {
        this.name = name;
        this.code = code;
        this.articleTypeCode = articleTypeCode;
    }

    public static String findArticleTypeCodeByCode(String code) {
        for (EmailTemplateTypeEnum emailTemplateType : values()) {
            if (emailTemplateType.code != null && emailTemplateType.code.equals(code)) {
                return emailTemplateType.articleTypeCode;
            }
        }
        return null;
    }
}
